wayland: Only try and process keyboard events when focussed
authorRob Bradford <rob@linux.intel.com>
Sun, 4 Aug 2013 13:01:10 +0000 (14:01 +0100)
committerRob Bradford <rob@linux.intel.com>
Sun, 4 Aug 2013 13:42:14 +0000 (14:42 +0100)
When combining Clutter with GTK+ we can receive events for surfaces which in
the client side we do not have focussed.

gdk/wayland/gdkdevice-wayland.c

index 862942cae75882604fdea1d7a837bf6fabd253eb..61cf9bc58c261584a6ac53d64d73a05923358dcd 100644 (file)
@@ -897,6 +897,8 @@ keyboard_handle_leave (void               *data,
     return;
   if (!GDK_IS_WINDOW (wl_surface_get_user_data (surface)))
     return;
+  if (!device->keyboard_focus)
+    return;
 
   _gdk_wayland_display_update_serial (wayland_display, serial);
 
@@ -1106,6 +1108,9 @@ keyboard_handle_key (void               *data,
   GdkWaylandDisplay *wayland_display =
     GDK_WAYLAND_DISPLAY (device->display);
 
+  if (!device->keyboard_focus)
+    return;
+
   device->repeat_count = 0;
   _gdk_wayland_display_update_serial (wayland_display, serial);
   deliver_key_event (data, time, key + 8, state_w);